/* CS32 FINAL PROJECT */

package GameEngine;

import Objects.*;
import GameEngine.GameConstants.Effect;
import GameEngine.GameConstants.Modifier;
import java.util.List;

/**
 * This class represents a group of objects which are related to eachother in some way.
 * Whenever an object has some effect which effects certain linked objects and not others,
 * it should be implemented int erms of a group. A group can be anywhere from 2 objects to
 * hundreds.
 * @author mhfowler
 */
public class Group {

    /* the list of objects in the group */
    private List<GameObject> objects;

    /** Adds an object to the group */
    public void addMember(GameObject o) {
        objects.add(o);
    }


    /**
     * This method takes in an effect and the power of that effect and applies
     * this effect to every object in the group. Be aware that if the object
     * which calls this is also in the group, it will also receive the effect.
     * @param e
     * @param power
     */
    public void effectGroup(Effect e, Vector dir, int power) {
        for (GameObject o : objects) {
            if (o.isExists()) {
                o.receiveEffect(e, dir, power);
            }
        }
    }




}
